<template>
    <div>
        <el-table :data="logsList" style="width: 100%" :stripe="true">
            <el-table-column type="index" label="日志编号" width="100">
            </el-table-column>
            <el-table-column prop="ip" label="ip地址"> </el-table-column>
            <el-table-column prop="time" label="登录时间"> </el-table-column>
            <el-table-column label="状态">
                <template slot-scope="scope">
                    <span>登录</span>
                </template>
            </el-table-column>
            <el-table-column label="姓名">
                <template slot-scope="scope">
                    <span>{{ scope.row.adminsId.account }}</span>
                </template>
            </el-table-column>
            <el-table-column prop="result" label="执行结果"> </el-table-column>
            <el-table-column label="操作">
                <template slot-scope="scope">
                    <el-button
                        type="primary"
                        icon="el-icon-delete"
                        @click="del(scope.row._id)"
                    ></el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
const {
    mapActions: logsMapActions,
    mapState: logsMapState,
} = createNamespacedHelpers("logs"); //主仓库引入子仓库的名称,
export default {
    data() {
        return {};
    },
    mounted() {
        this.getLogsList();
    },
    methods: {
        async del(val) {
            //软删除
            const data = await this.delLogs(val);
            console.log("得到的数据", data);
            if (data.status) {
                this.getLogsList();
            }
        },
        ...logsMapActions(["getLogsList", "delLogs"]),
    },
    computed: {
        ...logsMapState(["logsList"]),
    },
};
</script>

<style>
</style>